﻿#region License and Copyright Notice
// Copyright (c) 2010 Ananth B.
// All rights reserved.
// 
// The contents of this file are made available under the terms of the
// Eclipse Public License v1.0 (the "License") which accompanies this
// distribution, and is available at the following URL:
// http://www.opensource.org/licenses/eclipse-1.0.php
// 
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
// the specific language governing rights and limitations under the License.
// 
// By using this software in any fashion, you are agreeing to be bound by the
// terms of the License.
#endregion

using System;
using System.Linq.Expressions;
using System.Runtime.Serialization;

namespace Brahma
{
    [Serializable]
    public class InvalidExpressionTreeException : Exception
    {
        public InvalidExpressionTreeException(Expression expression)
        {
            Expression = expression;
        }

        public InvalidExpressionTreeException(string message, Expression expression)
            : base(string.Format("{0}\n{1}", message, expression))
        {
        }

        public InvalidExpressionTreeException(string message, Expression expression, Exception inner)
            : base(string.Format("{0}\n{1}", message, expression), inner)
        {
        }

        protected InvalidExpressionTreeException(
            SerializationInfo info,
            StreamingContext context)
            : base(info, context)
        {
        }

        public Expression Expression
        {
            get;
            set;
        }
    }
}